using UnityEngine;
using System.Collections;

public class cPathPoint : MonoBehaviour {
	
	
	public int Index = 0;
	public Vector3 vPosition;
	public float fRadius;
	public Texture2D icon;
	
	void Awake()
	{
		vPosition = transform.position;
		SphereCollider sc = (SphereCollider)collider;
		fRadius = sc.radius;
	}
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	public void OnDrawGizmos()
	{
		if(icon)
		{
			
			Gizmos.DrawIcon(transform.position,icon.name,true);
			
		}
		else
		{
			
			Gizmos.color = Color.red;
			
			Gizmos.DrawCube(transform.position, new Vector3(2,2,2));
			
		}
	}
	
	// sort
	private class sortIndexHelper: IComparer
	{
		
		int IComparer.Compare( object a, object b )
		{
			
			if ( a is cPathPoint && b is cPathPoint ) 
			{
				
				if ( (a as cPathPoint).Index > (b as cPathPoint).Index )
				
					return 1;
				
				if ( (a as cPathPoint).Index < (b as cPathPoint).Index )
				
					return -1;
				
				else
				
					return 0;
			}
			
			throw new System.ArgumentException("Object is not a User");
			
		}
		
	}
	
	public static IComparer sortIndex()
	{
		
		return (IComparer) new sortIndexHelper();
		
	}
}
